<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" import="java.util.*,com.lmpop.frame.SysMap" pageEncoding="UTF-8"%>
<%@ page import="com.lmpop.frame.bpm.BpmImpl;"%>
<%
	request.setCharacterEncoding("UTF-8");  

	String from = "";
	if(request.getHeader("referer")!=null){
		from = request.getHeader("referer").toString();
	}
	//System.out.println("<------------------------->"+request.getHeader("referer"));
	SysMap sysMap = new SysMap();
	if(request.getAttribute("sysMap")!=null){
		sysMap = (SysMap)request.getAttribute("sysMap");
	}
	session=request.getSession();
	if(sysMap.getString("session_cust_type")!=null){
		session.setAttribute("session_cust_type",sysMap.getString("session_cust_type"));
	}
	if(sysMap.getString("session_cust_class")!=null){
		session.setAttribute("session_cust_class",sysMap.getString("session_cust_class"));
	}
	 if(sysMap.getString("session_area_attr")!=null){
		session.setAttribute("session_area_attr",sysMap.getString("session_area_attr"));
	}

	Map paraMap = sysMap.getMap();
	Iterator iter = paraMap.keySet().iterator();

	String bpm_id = sysMap.getString("bpm_id");
	String jumpurl = sysMap.getString("jumpurl");
	
	//out.print("==============jumpurl2======"+jumpurl);

	int symbol = jumpurl.indexOf("?");
	String paraStr = "";
	if(symbol > -1){
		paraStr = jumpurl.substring(symbol+1,jumpurl.length());
		jumpurl = jumpurl.substring(0,symbol);
		//out.println("paraStr="+paraStr+",jumpurl="+jumpurl);
	}

	BpmImpl bpmImpl = new BpmImpl();
	Hashtable tradeMap = bpmImpl.getTradetypeMap(bpm_id);
	String trade_name="",judge_rights="",trade_kind="";
	if(tradeMap!=null && tradeMap.get("trade_name")!=null) trade_name = tradeMap.get("trade_name").toString();
	if(tradeMap!=null && tradeMap.get("judge_rights")!=null) judge_rights = tradeMap.get("judge_rights").toString();
	if(tradeMap!=null && tradeMap.get("trade_kind")!=null) trade_kind = tradeMap.get("trade_kind").toString();
	
	String result_info = sysMap.getString("result_info");
	String result_code = sysMap.getString("result_code");
	String is_tip = judge_rights;
	String to_url = trade_kind;

	if(jumpurl!=null&&!jumpurl.equals("")){
		to_url = jumpurl;
	}
	if(paraStr!=null&&!paraStr.equals("")){
		to_url = jumpurl+"?"+paraStr;
	}
	
	if(result_code.equals("0")){
		result_info = trade_name;
	}
	if(result_code.equals("9")){
		result_info = "您输入了非法字符，请检查后重新输入！"+result_info;
	}
	if(result_info.equals("5127-1")){
		result_info = "该商机已经有订单产生，不可以删除！";
	}
	if(!to_url.trim().equals("") && result_code.equals("0")) from = to_url;
	String tip_color = "";
	
	String tip_title = "";

	if(result_code.equals("1")){
		tip_title = "操作失败";
		tip_color = "red";
	}else if(result_code.equals("0")){
		tip_title = "操作成功";
		tip_color = "green";
	}
	
	//如果报错总会提示
	if(result_code.equals("1")){
		is_tip = "";
	}

	String uuidrand = UUID.randomUUID().toString();
%>
<html>
<head>
<title>success</title>
<STYLE type=text/css>
    body{ font-family:"Microsoft YaHei","Arial"}
   
	BODY {
		FONT-SIZE: 12px; 
	}
	
	A:link {
		COLOR: #ff0000; TEXT-DECORATION:underline;
	}
	A:visited {
		COLOR: #ff0000; TEXT-DECORATION: none
	}
	A:hover {
		COLOR: #ff0000; TEXT-DECORATION: underline
	}
	.boxtable{ border:3px solid #ccc; background:#f5f5f5; width:600px; height:300px; margin:0 auto; padding:0; text-align:center;}
	.boxtable h1{ margin-bottom:30px; margin-top:60px}
	.tishi{ font-size:16px;  width:500px; margin:0 auto;}
	{background:url(/templets/html/8diansp/images/accept.jpg) no-repeat;}
	</STYLE>
</head>
<body>
<form action="<%=from%>" method="post" name="succForm">
  <%
		while (iter.hasNext()){
		    Object key = iter.next();
		    Object val = paraMap.get(key);
		    if(val instanceof String){
				

	%>
  <input type="hidden" name="<%=key%>" value="<%=val.toString().replaceAll("<[^>]*>","").trim()%>" />
  <%
		    }
		}
	%>
  <%
		if(!paraStr.equals("")){
			String paraAttr[] = paraStr.split("&");
			if(paraAttr.length > 0){
				for(int i=0;i<paraAttr.length;i++){
					if(!paraAttr[i].equals("")){
						String paraone[] = paraAttr[i].split("=");
						if(paraone.length > 1){
	%>
  <input type="hidden" name="<%=paraone[0]%>" value="<%=paraone[1].replaceAll("<[^>]*>","").trim()%>" />
  <%
						}
					}
				}
			}
		}
	%>
  <input type="hidden" name="uuidrand" value="<%=uuidrand%>" />
</form>
<%if(is_tip.trim().equals("")){%>
<div class="boxtable"> <h1>操作提示信息!</h1>
  <div id="Logout" class="tishi"></div>
  <br/>
  <br/>
  <!--div class=""><a href="<%=from%>" >如果您的浏览器没有反应，请点击这里... </a></div-->
  <script> 
	
					var n=3;
					function Logout() {
				    document.getElementById("Logout").innerHTML = "<font color=<%=tip_color%>><%=result_info%>&nbsp;<%=tip_title%></font>&nbsp;系统将在"+n+"秒内返回!";
					n--;
				    if( n==0 ) {
						document.succForm.submit();
					}else{
						setTimeout( "Logout();", 1000 );
					}
				  } 
				
				 Logout();
					
	  		</script>
</div>
<%}else{%>
<script type="text/javascript">
		
			document.succForm.submit();
	
		</script>
<%}%>
</body>
</html>
